<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Drag and Drop!</title>
  </head>

  <body>
    <div
      draggable="true"
      id="drag_from"
      style="
        height: 200px;
        width: 200px;
        border: 2px 2px solid black;
        background: rebeccapurple;
      "
    ></div>

    <div
      draggable="true"
      id="drag_to"
      style="
        height: 200px;
        width: 200px;
        border: 2px 2px solid black;
        background: plum;
      "
    ></div>
  </body>

  <script>
    // drag_from.ondrag = (event) => { console.log(event) }
    drag_to.ondragover = (event) => {
      event.preventDefault();
    };
    drag_to.ondrop = (event) => {
      console.log("Drop");
    };
  </script>
</html>
